import re

path='/media/htmls/template/csdn/csdn/a/d/s/e/ghdf/dsfsfd.html'
path1='/media/htmls/template/iteye/iteye/a/d/s/e/ghdf/dsfsfd.html'
path2='/media/htmls/template/cnblogs/cnblogs/a/d/s/e/ghdf/dsfsfd.html'
path3='/media/htmls/template/n51cto/n51cto/a/d/s/e/ghdf/dsfsfd.html'





csdn_patt=re.compile('/csdn/csdn/')
#p=csdn_patt.sub('/csdn/',path)
#print p

iteye_patt=re.compile('/iteye/iteye/')
#p=iteye_patt.sub('/iteye/',path1)
#print p
cnblogs_patt=re.compile('/cnblogs/cnblogs/')
#p=cnblogs_patt.sub('/cnblogs/',path2)
#print p
n51cto_patt=re.compile('/n51cto/n51cto/')
#p=n51cto_patt.sub('/n51cto/',path3)

path=path1
suffix=2
p=''
if suffix==1:
    p=csdn_patt.sub('/csdn/',path)
elif suffix==2:
    p=iteye_patt.sub('/iteye/',path)
elif suffix==3:
    p=cnblogs_patt.sub('/cnblogs/',path)
elif suffix==4:
    p=n51cto_patt.sub('/n51cto/',path)

    


print p




